home *** CD-ROM | disk | FTP | other *** search
- Path: gambier.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Help with sin() - big problem
- Date: 5 Mar 1996 13:19:25 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4hib4tINN68q@gambier.ugrad.cs.ubc.ca>
- References: <4hhusi$49i@sunburst.ccs.yorku.ca>
- NNTP-Posting-Host: gambier.ugrad.cs.ubc.ca
-
- In article <4hhusi$49i@sunburst.ccs.yorku.ca>,
- Naftali Sturm <yu114405@yorku.ca> wrote:
- >I have a big problem.
- >I am making a math and trigonometry program which, one of its functions
- >is to compute the sine of a number.
- > The way I did it was.
- > result = sin(numb);
- >
- >result and num are both float's.
- > The problem is that when numb is 1.0, the
- >program gives me .84147 , and when numb is 45.0
- >the program gives me .85090, and each number is a different result.
- >However I took a look at my sine table in my trigonometry book, and
- >it says the sine of 1 is .018, the sine of 45 is .707, and
- >different results than what my program said.
- > Why?
-
- In case you don't understand the other two posts, I will clarify.
-
- Radians are a measure of angle, just like degrees. Whereas there are 360
- degrees in a fullc circle, by definition, radians are defined such that there
- are 2*PI radians in a circle. To convert degrees to radians, you divide by 360
- and multiply by 2*PI (or simplify that to x 180 / PI ).
-
- The radians measure is ``natural'' for measuring angles because the radius of a
- circle fits around the circle 2PI times. An angle of x radians around a radius
- of r traces out an arc length of rx. Furthermore, small radian angles can be
- approximated by the separation distance, divided by the radius. For example,
- if two 100-meter thin rods are connected at one end, and separated by a
- distance of 0.1 meters at the other end, you can readily find the approximate
- radian angle just by 0.1 / 100 = 0.001 rad, because the separation closely
- approximates the arc length. If you were working in degrees, you would have to
- divide by pi and multiply by 180, a pain to have to do.
-
- Another reason that radians are a ``natural'' measure for degrees is that the
- Taylor series expansions of the transcendental functions naturally work
- in radians without any odd scale factors in the independent variable.
- --
-
-